<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>法律法规查询系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" href="<%=path%>/static/layui/css/layui.css"/>
    <script src="<%=path%>/static/iconfont/iconfont.js"></script>
    <script type="text/javascript" src="<%=path%>/static/jquery/jquery-3.1.0.js"></script>
    <script type="text/javascript" src="<%=path%>/static/layui/layui.js"></script>
    <script src="<%=path%>/static/echarts/echarts.js"></script>
    <style>
        body {
            padding-left: 20px;
            padding-right: 20px;
            padding-top: 30px;
            padding-bottom: 30px;
        }
        .layui-form-label {
            width: 120px;
        }
        .layui-input-block {
            margin-left: 150px;
        }
    </style>
</head>
<body>
<div class="layui-form-item">
    <div id="button-div" class="layui-inline tool-btn  layui-btn-group" style="margin: 20px;">
        <button type="button" class="layui-btn layui-bg-blue" onclick="doubt_mark()">标记存疑</button>
        <button type="button" class="layui-btn layui-bg-blue" onclick="doubt_cancel()">取消存疑</button>
    </div>
</div>
<form id="dataForm" class="layui-form" action="" lay-filter="dataForm">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>▎ 原始单据信息</legend>
    </fieldset>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据编号</label>
                <div class="layui-input-block">
                    <input type="text" name="djbh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据日期</label>
                <div class="layui-input-block">
                    <input type="text" name="crerdate" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">制单人</label>
                <div class="layui-input-block">
                    <input type="text" name="crermc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据类型</label>
                <div class="layui-input-block">
                    <input type="text" name="djlxmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据金额</label>
                <div class="layui-input-block">
                    <input type="text" name="je" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="zy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">结算方式</label>
                <div class="layui-input-block">
                    <input type="text" name="jsfsmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">结算金额</label>
                <div class="layui-input-block">
                    <input type="text" name="jsje" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">所得税</label>
                <div class="layui-input-block">
                    <input type="text" name="sds" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">收款人</label>
                <div class="layui-input-block">
                    <input type="text" name="skr" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">开户银行</label>
                <div class="layui-input-block">
                    <input type="text" name="khyh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">银行账号</label>
                <div class="layui-input-block">
                    <input type="text" name="yhzh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">公务卡号</label>
                <div class="layui-input-block">
                    <input type="text" name="gwkh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">公务卡刷卡时间</label>
                <div class="layui-input-block">
                    <input type="text" name="gwksksj" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">资金往来对象</label>
                <div class="layui-input-block">
                    <input type="text" name="zjwldx" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据内容摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="nrzy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">支付金额</label>
                <div class="layui-input-block">
                    <input type="text" name="zfje" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">审核人</label>
                <div class="layui-input-block">
                    <input type="text" name="auditor" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>▎ U8指标信息</legend>
    </fieldset>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">指标ID</label>
                <div class="layui-input-block">
                    <input type="text" name="zbid" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">单据指标摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="djzbzy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">指标摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="zbzy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-block">
                    <input type="text" name="xmmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">预算项目</label>
                <div class="layui-input-block">
                    <input type="text" name="ysxmmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">资金性质</label>
                <div class="layui-input-block">
                    <input type="text" name="zjxzmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">指标文号</label>
                <div class="layui-input-block">
                    <input type="text" name="whmc" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">占用金额</label>
                <div class="layui-input-block">
                    <input type="text" name="zbzyje" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">是否政府采购</label>
                <div class="layui-input-block">
                    <input type="text" name="sfzfcg" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">政府采购方式</label>
                <div class="layui-input-block">
                    <input type="text" name="zfcgfs" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">政府采购合同编号</label>
                <div class="layui-input-block">
                    <input type="text" name="zfcghtbh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>▎ 财政支付信息</legend>
    </fieldset>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">支付单据类型</label>
                <div class="layui-input-block">
                    <input type="text" name="zfdjlx" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">支付指标摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzbzy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">部门经济分类</label>
                <div class="layui-input-block">
                    <input type="text" name="zfbmjjfl" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">政府经济分类</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzfjjfl" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">支出功能分类</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzcgnfl" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">资金性质</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzjxz" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">指标类型</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzblx" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">预算项目</label>
                <div class="layui-input-block">
                    <input type="text" name="zfxm" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">指标文号</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzbwh" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">是否包含政府采购</label>
                <div class="layui-input-block">
                    <input type="text" name="zfsfbhzfcg" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
    </div>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>▎ 制单信息</legend>
    </fieldset>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">制单状态</label>
                <div class="layui-input-block">
                    <input type="text" name="zfzt" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">制单备注</label>
                <div class="layui-input-block">
                    <input type="text" name="zfztbzxx" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">是否存疑</label>
                <div class="layui-input-block">
                    <input type="text" name="doubt" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
        <div class="layui-col-xs3">
            <div class="layui-form-item">
                <label class="layui-form-label">存疑摘要</label>
                <div class="layui-input-block">
                    <input type="text" name="doubtzy" class="layui-input" readonly="readonly" />
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    let form = layui.form;
    let layer = layui.layer;

    form.render();

    $(function () {
        search();
    })

    function search() {
        $.ajax({
            type: 'get',
            url: '<%=path%>/api/getDetail?id=${id}',
            success: function(rs) {
                if(rs.code == 200){
                    rs.data.xmmc = rs.data.xmdm + ' ' + rs.data.xmmc;
                    rs.data.ysxmmc = rs.data.ysxmdm + ' ' + rs.data.ysxmmc;
                    rs.data.zjxzmc = rs.data.zjxzdm + ' ' + rs.data.zjxzmc;
                    rs.data.whmc = rs.data.whdm + ' ' + rs.data.whmc;
                    rs.data.sfzfcg = rs.data.sfzfcg == 1 ? '是' : '否';
                    rs.data.zfzt = rs.data.zfzt == 0 ? '待支付' : (rs.data.zfzt == 1 ? '制单成功' : '制单失败');
                    rs.data.doubt = rs.data.doubt == 1 ? '是' : '否';
                    form.val("dataForm", rs.data);
                }else{
                    layer.msg(rs.message, {offset: '20px'});
                }
            }
        })
    }

    function doubt_mark() {
        layer.prompt({title: '存疑原因', formType: 2}, function(content, index){
            $.ajax({
                type: 'post',
                url: '<%=path%>/api/markDoubt',
                data: {
                    id: '${id}',
                    doubtzy: content
                },
                success: function(rs) {
                    layer.msg(rs.message, {offset: '20px'});
                    if(rs.code == 200) {
                        search();
                        layer.close(index);
                    }
                }
            })
        });
    }

    function doubt_cancel() {
        layer.confirm('确认取消存疑吗？', {
            btn: ['确定', '关闭'] //按钮
        }, function(){
            $.ajax({
                type: 'post',
                url: '<%=path%>/api/cancelDoubt',
                data: {
                    id: '${id}'
                },
                success: function(rs) {
                    layer.msg(rs.message, {offset: '20px'});
                    if(rs.code == 200) {
                        search();
                    }
                }
            })
        });
    }
</script>
</body>
</html>
